<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('原料仓库库存列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" id="warehouseId" name="warehouseId" th:value="${warehouse.id}">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>原料编号：</label>
                                <input type="text" name="rawMaterialId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="chooseTeaShop()" shiro:hasPermission="system:teaShopInventory:add">
                    <i class="fa fa-plus"></i> 发货
                </a>
                <a class="btn btn-primary" onclick="importMaterial()" shiro:hasPermission="system:teaShopInventory:add">
                    <i class="fa fa-plus"></i> 进货
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:teaShopInventory:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/warehouse/warehouseInventory";

        $(function() {
            var options = {
                url: prefix + "/warehouseInventoryList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "原料仓库库存",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'rawMaterialId',
                    title: '原料编号'
                },
                {
                    field: 'name',
                    title: '名称'
                },
                {
                    field: 'description',
                    title: '描述'
                },
                {
                    field: 'amount',
                    title: '数量(箱)'
                }
                    ,
                    {
                        field: 'supplier',
                        title: '供应商'
                    }

                ]
                };
                $.table.init(options);
            });

        /* 选择茶店 */
		function chooseTeaShop() {
			var url = prefix + '/chooseTeaShop/' + $("#warehouseId").val();
		    $.modal.open("选择茶店", url);
		}

        /* 进货 */
        function importMaterial() {
            var url = prefix + '/importMaterial/' + $("#warehouseId").val();
            $.modal.open("选择茶店", url);
        }
    </script>
</body>
</html>